#pragma once

#include <vector>
#include "MechEyeApi.h"
#include "SampleUtil.h"
#include <opencv2/opencv.hpp>
#include <algorithm>
#include <numeric>
class Camera_mech
{
public:
    Camera_mech();
    ~Camera_mech();

    bool openDevice();
    void closeDevice();

    bool is_connected();

    bool capture_pointCloud(cv::Mat& imgX, cv::Mat& imgY, cv::Mat& imgZ);
    bool capture_colorMap(cv::Mat& imgColor);

    bool capture_color_point(cv::Mat& imgColor,cv::Mat& imgX,cv::Mat& imgY,cv::Mat& imgZ);
    int detect_cloud_rect_xyz(cv::Rect rec, std::vector<float> &reslut);
    // 内外盖设置不同的相机拍照属性
    void set3D4Ident(bool isOuter);
private:
    mmind::api::MechEyeDevice m_device;
    mmind::api::ErrorStatus m_status;
    std::vector<mmind::api::MechEyeDeviceInfo> m_deviceList;

    mmind::api::PointXYZMap pointCloud;
    bool b_isConnect;

    int transFormatColor(mmind::api::ColorMap& src, cv::Mat &imgColor);
    int transFormatPoint(mmind::api::PointXYZMap& src, cv::Mat& imgX, cv::Mat& imgY, cv::Mat& imgZ);
    void printDeviceInfo();
    void printError();

    // 暂时没有用深度图
    bool capture_depthMap(mmind::api::DepthMap& depthMap);
};

